using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using XNAGameFeatures.Input.Device;

namespace XNAGameFeatures.Input
{
    public class InputManager
    {

        #region Fields

        public KeybordInput KeybordInput { get; set; }
        public GamePadInput GamePadInput { get; set; }
        public MouseInput MouseInput { get; set; }

        private static InputManager _instance;

        public static InputManager Instance
        {
            get { return _instance ?? (_instance = new InputManager()); }
        }

        public List<InputDevice> Devices { get; protected set; }

        #endregion

        private InputManager()
        {
            KeybordInput = new KeybordInput();
            GamePadInput = new GamePadInput();
            MouseInput = new MouseInput();

            Devices = new List<InputDevice> { KeybordInput, GamePadInput, MouseInput };
        }

        public virtual void Update()
        {
            foreach (var inputDevice in Devices)
            {
                inputDevice.Update();
            }
        }
    }
}
